package com.flowerplus.store.common.data.utils.ui;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Build;


/**
 * Created by ems on 2017/2/27.
 */

public class ResourcesUtil {

    Context mContext;

    public ResourcesUtil(Context context) {
        this.mContext = context;
    }

    public  String getString(int id) {
        return mContext.getString(id);
    }

    public Resources getResources() {
        return mContext.getResources();
    }

    public int getColor(int id) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            return mContext.getColor(id);
        } else {
            return getResources().getColor(id);
        }
    }

    public Drawable getDrawble(int id) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            return mContext.getDrawable(id);
        } else {
            return getResources().getDrawable(id);
        }
    }
}
